﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using MvcShop.MVC.Controllers;

namespace MvcShop.MVC.ViewPage
{
    public class SouthShopViewMasterPage:ViewMasterPage
    {
        protected string SiteUrl
        {
            get
            {
                return GetController().BaseControllerService.SiteUrl;
            }
        }

        private ISiteProvidesBaseService GetController()
        {
            if (ViewContext != null) return ViewContext.Controller as ISiteProvidesBaseService;
            throw new ApplicationException("Controller does not implement IProvidesBaseService");
        }

        protected string Title
        {
            get
            {
                return GetController().BaseControllerService.ShopName;
            }
        }

        protected string Email
        {
            get
            {
                return GetController().BaseControllerService.EmailAddress;
            }
        }

        protected string Copyright
        {
            get
            {
                return GetController().BaseControllerService.Copyright;
            }
        }

        protected string PhoneNumber
        {
            get
            {
                return GetController().BaseControllerService.PhoneNumber;
            }
        }

        protected string GoogleTrackingCode
        {
            get
            {
                return "\"{0}\"".With(GetController().BaseControllerService.GoogleTrackingCode);
            }
        }

        protected string RecordNumber 
        {
            get
            {
                return GetController().BaseControllerService.RecordNumber;
            }
        }

        protected string IPCNumber
        {
            get
            {
                return GetController().BaseControllerService.IPCNumber;
            }
        }
    }
}
